import request from '@/utils/request'

// 查询设备状态列表
export function listDeviceStatus(query: any) {
    return request({
        url: '/vending/status/list',
        method: 'get',
        params: query
    })
}

// 获取设备状态详细信息
export function getDeviceStatus(id: number) {
    return request({
        url: `/vending/status/${id}`,
        method: 'get'
    })
}

// 新增设备状态
export function addDeviceStatus(data: any) {
    return request({
        url: '/vending/status',
        method: 'post',
        data
    })
}

// 修改设备状态
export function updateDeviceStatus(data: any) {
    return request({
        url: '/vending/status',
        method: 'put',
        data
    })
}

// 根据设备编号修改设备状态
export function updateDeviceStatusByNo(data: any) {
    return request({
        url: '/vending/status/updateByDeviceNo',
        method: 'put',
        data
    })
}

// 删除设备状态
export function deleteDeviceStatus(id: number) {
    return request({
        url: `/vending/status/${id}`,
        method: 'delete'
    })
}

// 批量删除设备状态
export function deleteDeviceStatusBatch(ids: number[]) {
    return request({
        url: `/vending/status/batch/${ids}`,
        method: 'delete'
    })
}

// 更新设备在线状态
export function updateDeviceOnline(deviceId: number) {
    return request({
        url: `/vending/status/online/${deviceId}`,
        method: 'put'
    })
}

// 根据设备编号更新设备在线状态
export function updateDeviceOnlineByNo(deviceNo: string) {
    return request({
        url: `/vending/status/onlineByDeviceNo/${deviceNo}`,
        method: 'put'
    })
} 